import { Flex, Grid, Text } from '@chakra-ui/react';
import { RootState } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks';
import IAICollapse from 'common/components/IAICollapse';
import ParamSeedFull from 'features/parameters/components/Parameters/Seed/TourflySeed';
import ParamCFGScale from './ParamCFGScale';
import ParamSteps from './ParamSteps';
import ParamScheduler from './ParamScheduler';
import { useTranslation } from 'react-i18next';
import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning';

export default function ParamAdvancedCollapse() {
  const { t } = useTranslation();

  const disabledFeatures = useAppSelector(
    (state: RootState) => state.config.disabledFeatures
  );

  if (disabledFeatures.indexOf('tourflyAdvanced') >= 0) {
    return null;
  }

  return (
    <IAICollapse label={t('parameters.advanced')}>
      <Flex sx={{ flexDir: 'column', gap: 2 }}>
        <Flex direction="column">
          <Text fontSize="sm" fontWeight="bold" pb="1">
            {t('parameters.negativePrompt')}
          </Text>
          <ParamNegativeConditioning />
        </Flex>
        <Grid templateColumns="2fr 1fr 1fr" gap={3}>
          <ParamScheduler />
          <ParamSteps />
          <ParamCFGScale />
        </Grid>
        <ParamSeedFull />
      </Flex>
    </IAICollapse>
  );
}
